﻿-- =============================================
-- Author:		Andreas Könighofer (IT-eXperience)
-- Create date: 15.01.2009
-- Description:	Reads all machinetypes that match with the given parameters
-- =============================================
CREATE PROCEDURE [dbo].[ReadMachineType]
	-- Add the parameters for the stored procedure here
	@MachineTypeID SMALLINT = NULL
	, @MachineTypeName NVARCHAR(100) = NULL
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT
	MachineTypeID,
	MachineTypeName
	FROM MachineType
	WHERE ((@MachineTypeID IS NULL) OR (MachineTypeID = @MachineTypeID))
	AND ((@MachineTypeName IS NULL) OR (MachineTypeName LIKE '%'+@MachineTypeName+'%'))
END

---- end script ReadMachineType stored procedure ----

---- start script ReadRentalService stored procedure ----

